import { values } from "../../lib/runtime/runtime";
import {request} from "../../request/index.js"
import regeneratorRuntime from "../../lib/runtime/runtime"
// pages/search/index.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        goods:[]
    },
    timeId:-1,
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {

    },

    toSearch(e){
        const value = e.detail.value;   
        clearTimeout(this.timeId);
        this.timeId=setTimeout(()=>{
            this.qsearch(value);
        },1000)
       

    } ,
    async qsearch(query){
        const res = await request({url:"/goods/qsearch",data:{query}});
        console.log(res);
        this.setData({
            goods:res
        })

    }  
})